//
//  HomeDetailViewController.m
//  Share_Home_F
//
//  Created by dllo on 15/4/23.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "HomeDetailViewController.h"
#import "AFHTTPRequestOperationManager.h"
#import "PrefixHeader.pch"
#import "HomeDetailModel.h"
#import "UIImageView+WebCache.h"



#define WIDTH self.view.frame.size.width
//#define HEIGHT self.view.frame.size.height -200

//#define SCREEN_WIDTH self.view.frame.size.width
//#define SCREEN_HEIGHT self.view.frame.size.height
//#define IMAGEVIEW_COUNT 3


@interface HomeDetailViewController ()<UIScrollViewDelegate>
@property (nonatomic, assign)NSInteger index;
@end

@implementation HomeDetailViewController

- (void)dealloc
{
    [super dealloc];
}
-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        //  self.arr = [NSArray array];
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self createScrollView];
    
}
- (void)createScrollView
{
    self.scrollView =[[UIScrollView alloc] init];
    self.scrollView.frame = CGRectMake(0, 100, WIDTH, 300);
    self.scrollView.contentSize = CGSizeMake(WIDTH * self.arr.count, 0);
    self.scrollView.showsHorizontalScrollIndicator = NO;
    self.scrollView.showsVerticalScrollIndicator = NO;
    [self.view setBackgroundColor:[UIColor redColor]];
    self.scrollView.pagingEnabled = YES;
    [self.view addSubview:self.scrollView];
    
    [_scrollView release];
    
    for (NSInteger i = 0; i < self.arr.count; i++) {
        NSURL *url = [NSURL URLWithString:[self.arr[i] bimgfile]];
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH * i, 0, WIDTH, 300)];
        [imageView sd_setImageWithURL:url];
        [self.scrollView addSubview:imageView];
        
        if ([self.idNum isEqualToString: [self.arr[i] id]]) {

            self.index = i;
        }
    }
    self.scrollView.contentOffset = CGPointMake(WIDTH * (self.index ), 0);
}

@end
